package gameoflife.automaton;

import gameoflife.Cell;
import gameoflife.ChangeListener;
import gameoflife.Pattern;
import gameoflife.Position;
import gameoflife.Rule;

import java.util.Collection;

public interface Automaton {

	public void step(int steps);

	public void set(Position position, boolean value);
	public void toggle(Position position);
	public void addAll(Collection<Position> positions);

	public boolean isSet(Position position);
	public Cell getCell(Position position);

	public void clear();

	public Rule getRule();
	public void setRule(Rule rule);

	public int size();
	public int births();
	public int deaths();
	public int generation();

	public final int STEP_CHANGE_CODE = 1;
	public void addChangeListener(ChangeListener listener);

	public interface Visitor {
		public void visit(Cell cell);
	}
	public void accept(Visitor visitor);

	public Pattern toPattern();
}
